<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>DynaLoader - Dynamically load C libraries into Perl code - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/DynaLoader">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="DynaLoader.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/DynaLoader">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/DynaLoader">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/DynaLoader">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/DynaLoader">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/DynaLoader">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/DynaLoader">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/DynaLoader">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/DynaLoader">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/DynaLoader">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/DynaLoader">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/DynaLoader">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/DynaLoader">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/DynaLoader">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/DynaLoader">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/DynaLoader">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/DynaLoader">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/DynaLoader">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/DynaLoader">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/DynaLoader">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/DynaLoader">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/DynaLoader">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/DynaLoader">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/DynaLoader">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/DynaLoader">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/DynaLoader">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/DynaLoader">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/DynaLoader">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/DynaLoader">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/DynaLoader">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/DynaLoader">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/DynaLoader">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/DynaLoader">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/DynaLoader">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/DynaLoader">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/DynaLoader">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/DynaLoader">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/DynaLoader">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/DynaLoader">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/DynaLoader">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/DynaLoader">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/DynaLoader">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/DynaLoader">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/DynaLoader">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/DynaLoader">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/DynaLoader">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/DynaLoader">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/DynaLoader">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/DynaLoader">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/DynaLoader">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/DynaLoader">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/DynaLoader">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/DynaLoader">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/DynaLoader">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/DynaLoader">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/DynaLoader">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/DynaLoader">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/DynaLoader">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/DynaLoader">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/DynaLoader">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/DynaLoader">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/DynaLoader">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/DynaLoader">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/DynaLoader">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/DynaLoader">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/DynaLoader">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/DynaLoader">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/DynaLoader">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/DynaLoader">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/DynaLoader">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/DynaLoader">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/DynaLoader">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/DynaLoader">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/DynaLoader">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/DynaLoader">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/DynaLoader">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/DynaLoader">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/DynaLoader">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/DynaLoader">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/DynaLoader">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/DynaLoader">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="DynaLoader.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/DynaLoader">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/DynaLoader">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/DynaLoader">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/DynaLoader">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/DynaLoader">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/DynaLoader">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/DynaLoader">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/DynaLoader">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/DynaLoader">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/DynaLoader">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/DynaLoader">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/DynaLoader">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/DynaLoader">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/DynaLoader">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/DynaLoader">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/DynaLoader">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/DynaLoader">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/DynaLoader">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/DynaLoader">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/DynaLoader">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/DynaLoader">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/DynaLoader">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/DynaLoader">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/DynaLoader">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/DynaLoader">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/DynaLoader">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/DynaLoader">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/DynaLoader">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/DynaLoader">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/DynaLoader">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/DynaLoader">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/DynaLoader">5.35.1</a>
          <a class="dropdown-item active" href="DynaLoader.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="DynaLoader.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="DynaLoader.html">DynaLoader</a>
          <div id="more">
            (<a href="DynaLoader.txt">source</a>,
            <a href="https://metacpan.org/pod/DynaLoader">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.50</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="DynaLoader.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="DynaLoader.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="DynaLoader.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="DynaLoader.html#AUTHOR">AUTHOR</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="DynaLoader.html#NAME">#</a>NAME</h1>

<p>DynaLoader - Dynamically load C libraries into Perl code</p>

<h1 id="SYNOPSIS"><a class="permalink" href="DynaLoader.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>package YourPackage;
require DynaLoader;
@ISA = qw(... DynaLoader ...);
__PACKAGE__-&gt;bootstrap;

# optional method for &#39;global&#39; loading
sub dl_load_flags { 0x01 }     </code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="DynaLoader.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This document defines a standard generic interface to the dynamic linking mechanisms available on many platforms. Its primary purpose is to implement automatic dynamic loading of Perl modules.</p>

<p>This document serves as both a specification for anyone wishing to implement the DynaLoader for a new platform and as a guide for anyone wishing to use the DynaLoader directly in an application.</p>

<p>The DynaLoader is designed to be a very simple high-level interface that is sufficiently general to cover the requirements of SunOS, HP-UX, Linux, VMS and other platforms.</p>

<p>It is also hoped that the interface will cover the needs of OS/2, NT etc and also allow pseudo-dynamic linking (using <code>ld -A</code> at runtime).</p>

<p>It must be stressed that the DynaLoader, by itself, is practically useless for accessing non-Perl libraries because it provides almost no Perl-to-C &#39;glue&#39;. There is, for example, no mechanism for calling a C library function or supplying arguments. A C::DynaLib module is available from CPAN sites which performs that function for some common system types. And since the year 2000, there&#39;s also Inline::C, a module that allows you to write Perl subroutines in C. Also available from your local CPAN site.</p>

<p>DynaLoader Interface Summary</p>

<pre><code>@dl_library_path
@dl_resolve_using
@dl_require_symbols
$dl_debug
$dl_dlext
@dl_librefs
@dl_modules
@dl_shared_objects
                                                Implemented in:
bootstrap($modulename)                               Perl
@filepaths = dl_findfile(@names)                     Perl
$flags = $modulename-&gt;dl_load_flags                  Perl
$symref  = dl_find_symbol_anywhere($symbol)          Perl

$libref  = dl_load_file($filename, $flags)           C
$status  = dl_unload_file($libref)                   C
$symref  = dl_find_symbol($libref, $symbol)          C
@symbols = dl_undef_symbols()                        C
dl_install_xsub($name, $symref [, $filename])        C
$message = dl_error                                  C</code></pre>

<dl>

<dt id="@dl_library_path"><a class="permalink" href="DynaLoader.html#@dl_library_path">#</a><a id="dl_library_path"></a>@dl_library_path</dt>
<dd>

<p>The standard/default list of directories in which dl_findfile() will search for libraries etc. Directories are searched in order: $dl_library_path[0], [1], ... etc</p>

<p>@dl_library_path is initialised to hold the list of &#39;normal&#39; directories (<i>/usr/lib</i>, etc) determined by <b>Configure</b> (<code>$Config{&#39;libpth&#39;}</code>). This should ensure portability across a wide range of platforms.</p>

<p>@dl_library_path should also be initialised with any other directories that can be determined from the environment at runtime (such as LD_LIBRARY_PATH for SunOS).</p>

<p>After initialisation @dl_library_path can be manipulated by an application using push and unshift before calling dl_findfile(). Unshift can be used to add directories to the front of the search order either to save search time or to override libraries with the same name in the &#39;normal&#39; directories.</p>

<p>The load function that dl_load_file() calls may require an absolute pathname. The dl_findfile() function and @dl_library_path can be used to search for and return the absolute pathname for the library/object that you wish to load.</p>

</dd>
<dt id="@dl_resolve_using"><a class="permalink" href="DynaLoader.html#@dl_resolve_using">#</a><a id="dl_resolve_using"></a>@dl_resolve_using</dt>
<dd>

<p>A list of additional libraries or other shared objects which can be used to resolve any undefined symbols that might be generated by a later call to load_file().</p>

<p>This is only required on some platforms which do not handle dependent libraries automatically. For example the Socket Perl extension library (<i>auto/Socket/Socket.so</i>) contains references to many socket functions which need to be resolved when it&#39;s loaded. Most platforms will automatically know where to find the &#39;dependent&#39; library (e.g., <i>/usr/lib/libsocket.so</i>). A few platforms need to be told the location of the dependent library explicitly. Use @dl_resolve_using for this.</p>

<p>Example usage:</p>

<pre><code>@dl_resolve_using = dl_findfile(&#39;-lsocket&#39;);</code></pre>

</dd>
<dt id="@dl_require_symbols"><a class="permalink" href="DynaLoader.html#@dl_require_symbols">#</a><a id="dl_require_symbols"></a>@dl_require_symbols</dt>
<dd>

<p>A list of one or more symbol names that are in the library/object file to be dynamically loaded. This is only required on some platforms.</p>

</dd>
<dt id="@dl_librefs"><a class="permalink" href="DynaLoader.html#@dl_librefs">#</a><a id="dl_librefs"></a>@dl_librefs</dt>
<dd>

<p>An array of the handles returned by successful calls to dl_load_file(), made by bootstrap, in the order in which they were loaded. Can be used with dl_find_symbol() to look for a symbol in any of the loaded files.</p>

</dd>
<dt id="@dl_modules"><a class="permalink" href="DynaLoader.html#@dl_modules">#</a><a id="dl_modules"></a>@dl_modules</dt>
<dd>

<p>An array of module (package) names that have been bootstrap&#39;ed.</p>

</dd>
<dt id="@dl_shared_objects"><a class="permalink" href="DynaLoader.html#@dl_shared_objects">#</a><a id="dl_shared_objects"></a>@dl_shared_objects</dt>
<dd>

<p>An array of file names for the shared objects that were loaded.</p>

</dd>
<dt id="dl_error()"><a class="permalink" href="DynaLoader.html#dl_error()">#</a><a id="dl_error"></a>dl_error()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$message = dl_error();</code></pre>

<p>Error message text from the last failed DynaLoader function. Note that, similar to errno in unix, a successful function call does not reset this message.</p>

<p>Implementations should detect the error as soon as it occurs in any of the other functions and save the corresponding message for later retrieval. This will avoid problems on some platforms (such as SunOS) where the error message is very temporary (e.g., dlerror()).</p>

</dd>
<dt id="$dl_debug"><a class="permalink" href="DynaLoader.html#$dl_debug">#</a><a id="dl_debug"></a>$dl_debug</dt>
<dd>

<p>Internal debugging messages are enabled when $dl_debug is set true. Currently setting $dl_debug only affects the Perl side of the DynaLoader. These messages should help an application developer to resolve any DynaLoader usage problems.</p>

<p>$dl_debug is set to <code>$ENV{&#39;PERL_DL_DEBUG&#39;}</code> if defined.</p>

<p>For the DynaLoader developer/porter there is a similar debugging variable added to the C code (see dlutils.c) and enabled if Perl was built with the <b>-DDEBUGGING</b> flag. This can also be set via the PERL_DL_DEBUG environment variable. Set to 1 for minimal information or higher for more.</p>

</dd>
<dt id="$dl_dlext"><a class="permalink" href="DynaLoader.html#$dl_dlext">#</a><a id="dl_dlext"></a>$dl_dlext</dt>
<dd>

<p>When specified (localised) in a module&#39;s <i>.pm</i> file, indicates the extension which the module&#39;s loadable object will have. For example:</p>

<pre><code>local $DynaLoader::dl_dlext = &#39;unusual_ext&#39;;</code></pre>

<p>would indicate that the module&#39;s loadable object has an extension of <code>unusual_ext</code> instead of the more usual <code>$Config{dlext}</code>. NOTE: This also requires that the module&#39;s <i>Makefile.PL</i> specify (in <code>WriteMakefile()</code>):</p>

<pre><code class="plaintext">DLEXT =&gt; &#39;unusual_ext&#39;,</code></pre>

</dd>
<dt id="dl_findfile()"><a class="permalink" href="DynaLoader.html#dl_findfile()">#</a><a id="dl_findfile"></a>dl_findfile()</dt>
<dd>

<p>Syntax:</p>

<pre><code>@filepaths = dl_findfile(@names)</code></pre>

<p>Determine the full paths (including file suffix) of one or more loadable files given their generic names and optionally one or more directories. Searches directories in @dl_library_path by default and returns an empty list if no files were found.</p>

<p>Names can be specified in a variety of platform independent forms. Any names in the form <b>-lname</b> are converted into <i>libname.*</i>, where <i>.*</i> is an appropriate suffix for the platform.</p>

<p>If a name does not already have a suitable prefix and/or suffix then the corresponding file will be searched for by trying combinations of prefix and suffix appropriate to the platform: &quot;$name.o&quot;, &quot;lib$name.*&quot; and &quot;$name&quot;.</p>

<p>If any directories are included in @names they are searched before @dl_library_path. Directories may be specified as <b>-Ldir</b>. Any other names are treated as filenames to be searched for.</p>

<p>Using arguments of the form <code>-Ldir</code> and <code>-lname</code> is recommended.</p>

<p>Example:</p>

<pre><code>@dl_resolve_using = dl_findfile(qw(-L/usr/5lib -lposix));</code></pre>

</dd>
<dt id="dl_expandspec()"><a class="permalink" href="DynaLoader.html#dl_expandspec()">#</a><a id="dl_expandspec"></a>dl_expandspec()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$filepath = dl_expandspec($spec)</code></pre>

<p>Some unusual systems, such as VMS, require special filename handling in order to deal with symbolic names for files (i.e., VMS&#39;s Logical Names).</p>

<p>To support these systems a dl_expandspec() function can be implemented either in the <i>dl_*.xs</i> file or code can be added to the dl_expandspec() function in <i>DynaLoader.pm</i>. See <i>DynaLoader_pm.PL</i> for more information.</p>

</dd>
<dt id="dl_load_file()"><a class="permalink" href="DynaLoader.html#dl_load_file()">#</a><a id="dl_load_file"></a>dl_load_file()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$libref = dl_load_file($filename, $flags)</code></pre>

<p>Dynamically load $filename, which must be the path to a shared object or library. An opaque &#39;library reference&#39; is returned as a handle for the loaded object. Returns undef on error.</p>

<p>The $flags argument to alters dl_load_file behaviour. Assigned bits:</p>

<pre><code class="plaintext">0x01  make symbols available for linking later dl_load_file&#39;s.
      (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
      (ignored under VMS; this is a normal part of image linking)</code></pre>

<p>(On systems that provide a handle for the loaded object such as SunOS and HPUX, $libref will be that handle. On other systems $libref will typically be $filename or a pointer to a buffer containing $filename. The application should not examine or alter $libref in any way.)</p>

<p>This is the function that does the real work. It should use the current values of @dl_require_symbols and @dl_resolve_using if required.</p>

<pre><code>SunOS: dlopen($filename)
HP-UX: shl_load($filename)
Linux: dld_create_reference(@dl_require_symbols); dld_link($filename)
VMS:   lib$find_image_symbol($filename,$dl_require_symbols[0])</code></pre>

<p>(The dlopen() function is also used by Solaris and some versions of Linux, and is a common choice when providing a &quot;wrapper&quot; on other mechanisms as is done in the OS/2 port.)</p>

</dd>
<dt id="dl_unload_file()"><a class="permalink" href="DynaLoader.html#dl_unload_file()">#</a><a id="dl_unload_file"></a>dl_unload_file()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$status = dl_unload_file($libref)</code></pre>

<p>Dynamically unload $libref, which must be an opaque &#39;library reference&#39; as returned from dl_load_file. Returns one on success and zero on failure. This function is optional and may not necessarily be provided on all platforms.</p>

<p>If it is defined and perl is compiled with the C macro <code>DL_UNLOAD_ALL_AT_EXIT</code> defined, then it is called automatically when the interpreter exits for every shared object or library loaded by DynaLoader::bootstrap. All such library references are stored in @dl_librefs by DynaLoader::Bootstrap as it loads the libraries. The files are unloaded in last-in, first-out order.</p>

<p>This unloading is usually necessary when embedding a shared-object perl (e.g. one configured with -Duseshrplib) within a larger application, and the perl interpreter is created and destroyed several times within the lifetime of the application. In this case it is possible that the system dynamic linker will unload and then subsequently reload the shared libperl without relocating any references to it from any files DynaLoaded by the previous incarnation of the interpreter. As a result, any shared objects opened by DynaLoader may point to a now invalid &#39;ghost&#39; of the libperl shared object, causing apparently random memory corruption and crashes. This behaviour is most commonly seen when using Apache and mod_perl built with the APXS mechanism.</p>

<pre><code>SunOS: dlclose($libref)
HP-UX: ???
Linux: ???
VMS:   ???</code></pre>

<p>(The dlclose() function is also used by Solaris and some versions of Linux, and is a common choice when providing a &quot;wrapper&quot; on other mechanisms as is done in the OS/2 port.)</p>

</dd>
<dt id="dl_load_flags()"><a class="permalink" href="DynaLoader.html#dl_load_flags()">#</a><a id="dl_load_flags"></a>dl_load_flags()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$flags = dl_load_flags $modulename;</code></pre>

<p>Designed to be a method call, and to be overridden by a derived class (i.e. a class which has DynaLoader in its @ISA). The definition in DynaLoader itself returns 0, which produces standard behavior from dl_load_file().</p>

</dd>
<dt id="dl_find_symbol()"><a class="permalink" href="DynaLoader.html#dl_find_symbol()">#</a><a id="dl_find_symbol"></a>dl_find_symbol()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$symref = dl_find_symbol($libref, $symbol)</code></pre>

<p>Return the address of the symbol $symbol or <code>undef</code> if not found. If the target system has separate functions to search for symbols of different types then dl_find_symbol() should search for function symbols first and then other types.</p>

<p>The exact manner in which the address is returned in $symref is not currently defined. The only initial requirement is that $symref can be passed to, and understood by, dl_install_xsub().</p>

<pre><code>SunOS: dlsym($libref, $symbol)
HP-UX: shl_findsym($libref, $symbol)
Linux: dld_get_func($symbol) and/or dld_get_symbol($symbol)
VMS:   lib$find_image_symbol($libref,$symbol)</code></pre>

</dd>
<dt id="dl_find_symbol_anywhere()"><a class="permalink" href="DynaLoader.html#dl_find_symbol_anywhere()">#</a><a id="dl_find_symbol_anywhere"></a>dl_find_symbol_anywhere()</dt>
<dd>

<p>Syntax:</p>

<pre><code>$symref = dl_find_symbol_anywhere($symbol)</code></pre>

<p>Applies dl_find_symbol() to the members of @dl_librefs and returns the first match found.</p>

</dd>
<dt id="dl_undef_symbols()"><a class="permalink" href="DynaLoader.html#dl_undef_symbols()">#</a><a id="dl_undef_symbols"></a>dl_undef_symbols()</dt>
<dd>

<p>Example</p>

<pre><code>@symbols = dl_undef_symbols()</code></pre>

<p>Return a list of symbol names which remain undefined after load_file(). Returns <code>()</code> if not known. Don&#39;t worry if your platform does not provide a mechanism for this. Most do not need it and hence do not provide it, they just return an empty list.</p>

</dd>
<dt id="dl_install_xsub()"><a class="permalink" href="DynaLoader.html#dl_install_xsub()">#</a><a id="dl_install_xsub"></a>dl_install_xsub()</dt>
<dd>

<p>Syntax:</p>

<pre><code>dl_install_xsub($perl_name, $symref [, $filename])</code></pre>

<p>Create a new Perl external subroutine named $perl_name using $symref as a pointer to the function which implements the routine. This is simply a direct call to newXS()/newXS_flags(). Returns a reference to the installed function.</p>

<p>The $filename parameter is used by Perl to identify the source file for the function if required by die(), caller() or the debugger. If $filename is not defined then &quot;DynaLoader&quot; will be used.</p>

</dd>
<dt id="bootstrap()"><a class="permalink" href="DynaLoader.html#bootstrap()">#</a><a id="bootstrap"></a>bootstrap()</dt>
<dd>

<p>Syntax:</p>

<p>bootstrap($module [...])</p>

<p>This is the normal entry point for automatic dynamic loading in Perl.</p>

<p>It performs the following actions:</p>

<ul>

<li><p>locates an auto/$module directory by searching @INC</p>

</li>
<li><p>uses dl_findfile() to determine the filename to load</p>

</li>
<li><p>sets @dl_require_symbols to <code>(&quot;boot_$module&quot;)</code></p>

</li>
<li><p>executes an <i>auto/$module/$module.bs</i> file if it exists (typically used to add to @dl_resolve_using any files which are required to load the module on the current platform)</p>

</li>
<li><p>calls dl_load_flags() to determine how to load the file.</p>

</li>
<li><p>calls dl_load_file() to load the file</p>

</li>
<li><p>calls dl_undef_symbols() and warns if any symbols are undefined</p>

</li>
<li><p>calls dl_find_symbol() for &quot;boot_$module&quot;</p>

</li>
<li><p>calls dl_install_xsub() to install it as &quot;${module}::bootstrap&quot;</p>

</li>
<li><p>calls &amp;{&quot;${module}::bootstrap&quot;} to bootstrap the module (actually it uses the function reference returned by dl_install_xsub for speed)</p>

</li>
</ul>

<p>All arguments to bootstrap() are passed to the module&#39;s bootstrap function. The default code generated by <i>xsubpp</i> expects $module [, $version] If the optional $version argument is not given, it defaults to <code>$XS_VERSION // $VERSION</code> in the module&#39;s symbol table. The default code compares the Perl-space version with the version of the compiled XS code, and croaks with an error if they do not match.</p>

</dd>
</dl>

<h1 id="AUTHOR"><a class="permalink" href="DynaLoader.html#AUTHOR">#</a>AUTHOR</h1>

<p>Tim Bunce, 11 August 1994.</p>

<p>This interface is based on the work and comments of (in no particular order): Larry Wall, Robert Sanders, Dean Roehrich, Jeff Okamoto, Anno Siegel, Thomas Neumann, Paul Marquess, Charles Bailey, myself and others.</p>

<p>Larry Wall designed the elegant inherited bootstrap mechanism and implemented the first Perl 5 dynamic loader using it.</p>

<p>Solaris global loading added by Nick Ing-Simmons with design/coding assistance from Tim Bunce, January 1996.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
